//
//  MyLeaveVC.m
//  SchoolTask
//
//  Created by feel on 16/8/26.
//  Copyright © 2016年 sm. All rights reserved.
//

#import "MyLeaveVC.h"
#import "MyLeave.h"
#import "MyAskLeaveVC.h"


@interface MyLeaveVC ()
@property (nonatomic,retain) NSString *urlStr;
@property (nonatomic,retain) NSDictionary *urlParameters;
@end

@implementation MyLeaveVC

//请求数据
- (void)fecthDataFromNet:(NSString *)url parameters:(NSDictionary *)parameter {
    
    NSLog(@"%@",url);
    NSLog(@"%@",parameter);
    //初始化请求工具
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    [manager POST:url parameters:parameter progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        NSMutableDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
        //        NSLog(@"登录-%@",dic[@"message"]);
        NSLog(@"MyViewController-%@",dic);
        NSLog(@"message == %@",dic[@"message"]);
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        
    }];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
    _urlStr = @"http://www.100xsys.com.cn/school/app/ajax_leaveInfo/add";
    _urlParameters = [[NSDictionary alloc]initWithObjectsAndKeys:@"1",@"appWebConfigId",@"xuesheng1",@"leaveInfo.loginName",@"xuesheng1",@"leaveInfo.realName",@"1",@"leaveInfo.accoutType",@"病假",@"leaveInfo.type",@"2016-08-01 10:00:00",@"startTime",@"2016-08-01 10:00:00",@"endTime",@"发烧",@"leaveInfo.content",@"无",@"leaveInfo.filesUrl",@"2",@"leaveInfo.status", nil];
    [self fecthDataFromNet:_urlStr parameters:_urlParameters];

    MyLeave *leave = [[MyLeave alloc]init];
    CGRect rect = leave.frame;
    rect.origin.y = 10;
    leave.frame = rect;
    [self.view addSubview:leave];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
